home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / Views.fr < prev   
Encoding:
Text File  |  1996-09-17  |  5.6 KB  |  189 lines  |  [TEXT/BROW]

  1. //========================================================================================
  2. //
  3. //    File:                Views.fr
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Contains:            Common (Platform independent) resources for the Draw part
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWRESFIL_K
  13. #include "FWResFil.k"
  14. #endif
  15.  
  16. #ifndef FWVIEWS_FR
  17. #include "FWViews.fr"
  18. #endif
  19.  
  20. #ifndef DEFINES_K
  21. #include "Defines.k"
  22. #endif
  23.  
  24. //========================================================================================
  25. // type FW_RRuler
  26. //========================================================================================
  27.  
  28. type FW_RRuler : FW_RSuperView(Label='rulr')
  29. {
  30. };
  31.  
  32. //========================================================================================
  33. // type RDrawView
  34. //========================================================================================
  35.  
  36. type RDrawView : FW_RSuperView(Label='drvw')
  37. {
  38. };
  39.  
  40. //========================================================================================
  41. // resource RDrawFrame(kDrawView)
  42. //========================================================================================
  43. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  44.  
  45. // Reference size for the Draw frame (will be adjusted at runtime)
  46. #define H     FW_FIX(1000)
  47. #define H1     H + FW_FIX(1)
  48.  
  49. // Ruler width
  50. #define R     FW_FIX(15)
  51.  
  52. // Drawing extent (sizes defined in Defines.k to be used also in .cpp files)
  53. #define X    FW_FIX(kDrawingSizeX)
  54. #define Y    FW_FIX(kDrawingSizeY)
  55.  
  56. resource FW_RFrameLayout(kDrawView)
  57. {
  58.     {H,H},                    // LayoutSize
  59.     {                        // Start list of frame's subviews
  60.         RDrawView
  61.         (
  62.             kDrawViewID,                        // View id
  63.             {R, R, H-R-FW_SBSIZE, H-R-FW_SBSIZE},// Bounds
  64.             FW_kFitToEnclosure,                    // bindings
  65.             {X,Y},                                // extent
  66.             1,                                    // Make it the ContentView
  67.             FW_kXYScrolling,                    // scrolling flag
  68.             {}                                    // no SubViews
  69.         ),
  70.         FW_RScrollBar            // Horizontal SB
  71.         (
  72.             kHorzScrollBarID,                    // View id
  73.             {-FW_ONE, H-FW_SBSIZE, H1-FW_SBSIZE, H1},// Bounds
  74.             FW_kHScrollBarBinding,                // Standard horizontal SB bindings
  75.             0,                                    // control message
  76.             0,                                    // control receiver
  77.             0,                                    // control value
  78.             0,                                    // SB Min Value (adjusted at runtime)
  79.             1,                                    // SB Max Value (adjusted at runtime)
  80.             FW_ONE,                                // SB Minor Units (adjusted at runtime)
  81.             FW_ONE                                // SB Major Units (adjusted at runtime)
  82.         ),
  83.         FW_RScrollBar            // Vertical SB
  84.         (
  85.             kVertScrollBarID,                    // View id
  86.             {H-FW_SBSIZE,-FW_ONE, H1, H1-FW_SBSIZE},// Bounds
  87.             FW_kVScrollBarBinding,                // Standard vertical SB binding
  88.             0,                                    // control message
  89.             0,                                    // control receiver
  90.             0,                                    // control value
  91.             0,                                    // SB Min Value (adjusted at runtime)
  92.             1,                                    // SB Max Value (adjusted at runtime)
  93.             FW_ONE,                                // SB Minor Units (adjusted at runtime)
  94.             FW_ONE                                // SB Major Units (adjusted at runtime)
  95.         ),
  96.         FW_RGrowBox
  97.         (
  98.             kGrowBoxID,                            // View id
  99.             {H - FW_SBSIZE, H - FW_SBSIZE, H1, H1},    // Bounds
  100.             FW_kGrowBoxBinding                    // standard grow box binding
  101.         ),
  102.         FW_RRuler                // Horizontal ruler
  103.         (
  104.             kHorzRulerID,                        // View id
  105.             {R, 0, H-FW_SBSIZE, R},                // Bounds
  106.             FW_kFixedBounds,                    // bindings
  107.             {X,R},                                // extent
  108.             0,                                    // not the ContentView
  109.             FW_kXScrolling,                        // scrolling flag
  110.             {}                                    // no SubViews
  111.         ),
  112.         FW_RRuler                // Vertical ruler
  113.         (
  114.             kVertRulerID,                        // View id
  115.             {0, R, R, H-FW_SBSIZE},                // Bounds
  116.             FW_kFixedBounds,                    // bindings
  117.             {R,Y},                                // extent
  118.             0,                                    // not the ContentView
  119.             FW_kYScrolling,                        // scrolling flag
  120.             {}                                    // no SubViews
  121.         )
  122.     },
  123.     {                            // Scroller
  124.         FW_RScrollBarScroller
  125.         (
  126.             FW_FIX(15),                            // AutoScrollInset
  127.             {FW_FIX(36), FW_FIX(36)},            // scroll Unit
  128.             1,                                    // Responds to function key
  129.             0,                                    // Live Scrolling
  130.             kHorzScrollBarID,                    // horiz sb id
  131.             kVertScrollBarID                    // vertical sb id
  132.         )
  133.     }
  134. };
  135.  
  136. //-------------------------------------------------------------------------------------
  137. //  Duplicate RDrawFrame resource without GrowBox and Scroll-bars for non-root frames
  138. //-------------------------------------------------------------------------------------
  139. // (See also how the Container sample avoids duplicating resources when there are
  140. //  differences between root and non-root frames)
  141.  
  142. resource FW_RFrameLayout(kDrawViewNotRoot)
  143. {
  144.     {H,H},                    // LayoutSize
  145.     {                        // Start list of frame's subviews
  146.         RDrawView
  147.         (
  148.             kDrawViewID,                        // View id
  149.             {R, R, H-R-FW_SBSIZE, H-R-FW_SBSIZE},// Bounds
  150.             FW_kFitToEnclosure,                    // bindings
  151.             {X,Y},                                // extent
  152.             1,                                    // Make it the ContentView
  153.             FW_kXYScrolling,                    // scrolling flag
  154.             {}                                    // no SubViews
  155.         ),
  156.         FW_RRuler                // Horizontal ruler
  157.         (
  158.             kHorzRulerID,                        // View id
  159.             {R, 0, H-FW_SBSIZE, R},                // Bounds
  160.             FW_kFixedBounds,                    // bindings
  161.             {X,R},                                // extent
  162.             0,                                    // not the ContentView
  163.             FW_kXScrolling,                        // scrolling flag
  164.             {}                                    // no SubViews
  165.         ),
  166.         FW_RRuler                // Vertical ruler
  167.         (
  168.             kVertRulerID,                        // View id
  169.             {0, R, R, H-FW_SBSIZE},                // Bounds
  170.             FW_kFixedBounds,                    // bindings
  171.             {R,Y},                                // extent
  172.             0,                                    // not the ContentView
  173.             FW_kYScrolling,                        // scrolling flag
  174.             {}                                    // no SubViews
  175.         )
  176.     },
  177.     {                            // Scroller
  178.         FW_RScrollBarScroller
  179.         (
  180.             FW_FIX(15),                            // AutoScrollInset
  181.             {FW_FIX(36), FW_FIX(36)},            // ScrollUnit
  182.             1,                                    // Responds to function key
  183.             0,                                    // Live Scrolling
  184.             kHorzScrollBarID,                    // horiz sb id
  185.             kVertScrollBarID                    // vertical sb id
  186.         )
  187.     }
  188. };
  189.